﻿using CRM.Infrastructure.Attr;
using CRM.Infrastructure.Dto.Response;
using CRM.Infrastructure.EFCore.Mysql;
using CRM.Infrastructure.IOC;
using CRM.Service.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CRM.Service.Instance
{
    [Inject_]
    public class Log_Service : Base_Service, I_Log_Service
    {
        private readonly Log_IOC _log_IOC;

        public Log_Service(Log_IOC log_IOC)
        {
            _log_IOC = log_IOC;
        }

        public void Add_Action_Log(SysActionLog sysActionLogs)
        {
            _log_IOC._sys_Action_Log_EFCore.Add(sysActionLogs);
            _log_IOC._sys_Action_Log_EFCore.SaveChanges();
        }

        public Api_Response_Dto Add_Error(SysErrorLog sysErrorLog)
        {
            _log_IOC._sys_Error_Log_EFCore.Add(sysErrorLog);
            var result = _log_IOC._sys_Error_Log_EFCore.SaveChanges();
            return Result(result);
        }
    }
}
